package com.hyper_yang._04_jvm.chap02;

public class ClassLoaderDemo2 {

    //类加载器之间是关联关系，不是继承关系。
    public static void main(String[] args) {

        ClassLoaderDemo2 demo2 = new ClassLoaderDemo2();

        //AppClassLoader
        System.out.println(demo2.getClass().getClassLoader()); //jdk.internal.loader.ClassLoaders$AppClassLoader@63947c6b
        System.out.println(ClassLoader.getSystemClassLoader()); //jdk.internal.loader.ClassLoaders$AppClassLoader@63947c6b

        //PlatformClassLoader
        System.out.println(demo2.getClass().getClassLoader().getParent()); //jdk.internal.loader.ClassLoaders$PlatformClassLoader@7699a589

        //null(BootstrapClassLoader)  C++  无法获取
        System.out.println(demo2.getClass().getClassLoader().getParent().getParent());

        //null(BootstrapClassLoader)  C++
        String s = new String();
        System.out.println(s.getClass().getClassLoader());
    }
}